Get the host name¶
Get the name of the host on which the routine is running.
import socket
host_name = socket.gethostname()
print("Host name:", host_name)
Output:
Host name: server
import socket
host_name = socket.gethostname()
print("Host name:", host_name)
Output:
Host name: server